<?php
  require_once 'lib/lang.lib.php';
  require_once 'lib/translate.lib.php';

  $kleolang = new translate();
  if(isset($_POST['file'])){
    require_once $_POST['file'];
  }
  
  require_once 'views/head.php';
  if(!isset($_GET['action'])){
   $_GET['action'] = null;
  }
  switch($_GET['action']){
    case 'selected':
      require_once 'views/working.php';
    break;
    case 'process':
      require_once 'views/process.php';
	$file = 'output/'.$_SESSION['file'].rand();
	$handle = fopen($file, 'w') or die("can't open file");
	fwrite($handle, $_SESSION['code']);
	fclose($handle);

    break;
    default:
      require_once 'views/main.php';
    break;
  }
  require_once 'views/foot.php';
?>
